/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * Licensed under Simplified BSD License
 *
 *
 * @author: jin Chen 
 * @date: Jan 29, 2005$
 * @version: 1.0
 */
package edu.psu.geovista.app.plot.ruler;

import edu.psu.geovista.app.plot.axis.Range;
import edu.psu.geovista.app.plot.ruler.tick.AxisLineTick;
import edu.psu.geovista.app.plot.ruler.tick.Tick;

import java.awt.*;

public class AxisTickRuler extends DfRuler {
    public AxisTickRuler() {
        super();
        //this.setUI(new AxisTickRulerUI(this));
    }

    public AxisTickRuler(int orient, int length, Point op, Range range) {
        super(orient, length, op, range);
        //this.setUI(new AxisTickRulerUI(this));
    }
   /* protected void installUI() {

        this.ui = new AxisTickRulerUI(this);
        this.pcs.addPropertyChangeListener((PropertyChangeListener)ui);
    }*/
    protected RulerUI createDefaultUI(Ruler r){
        return  new AxisTickRulerUI(r);
    }

    public void setAxisLineLength(int len){
        AxisTickRulerUI ui = (AxisTickRulerUI) this.getUI();
        ui.setTickAxisLineLength(len);
    }
    //
    public void setDrawAxisLine(boolean draw){
        Tick[] ticks = this.ui.getTicks();
        for (int i=0;i<ticks.length ;i++){
            AxisLineTick tick = (AxisLineTick) ticks[i];
            tick.setDrawAxisLine(draw);
        }
    }
}
